package com.hspedu;

import java.util.function.Function;

public class T1 {
    public static void main(String[] args) {
        System.out.println( hi("小花猫",str->new Cat(str)));
    }
    public static Dog hi(String str, Function<String,Cat> function){
        Cat cat = function.apply(str);
        Dog dog = new Dog();
        dog.setName(cat.getName()+"变成了小狗名");
        return dog;
    }
}
class Dog{
    private String name;

    public String getName() {
        return name;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                '}';
    }

    public void setName(String name) {
        this.name = name;
    }
}
class Cat{
    private String name;

    public Cat() {
    }

    public Cat(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}